package com.study.gupao.proxy.jdkproxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @ClassName: JdkInvocationHandler
 * @Description: jdk动态代理
 * @author: Adminstrator
 * @Date: 2019-03-13 22:33
 */
public class JdkInvocationHandler implements InvocationHandler {
    private Object target;

    public JdkInvocationHandler(Object target){
        this.target = target;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("JdkInvocationHandler调用jdk代理之前");
        Object object = method.invoke(target,args);
        System.out.println("JdkInvocationHandler调用jdk代理之后");
        return object;
    }
}
